Skip to content

Extract custom watch paths to specifications#7220

Merged
isaacroldan merged 3 commits intomainfrom
04-08-extract_custom_watch_paths_to_specifications
Apr 10, 2026
Merged

Extract custom watch paths to specifications#7220
isaacroldan merged 3 commits intomainfrom
04-08-extract_custom_watch_paths_to_specifications

Conversation

@isaacroldan
Copy link
Copy Markdown
Contributor

@isaacroldan isaacroldan commented Apr 8, 2026

WHY are these changes introduced?

The current file watching system for dev sessions uses a hardcoded approach where function extensions have custom watch paths while other extensions watch everything. This creates inconsistent behavior and makes it difficult for different extension types to define their own watching requirements.

WHAT is this pull request doing?

Refactors the dev session file watching system to use a specification-based approach:

  • Replaces devSessionCustomWatchPaths with a new devSessionWatchConfig method on extension specifications
  • Introduces a DevSessionWatchConfig interface that allows extensions to define both paths to watch and patterns to ignore
  • Moves function-specific watch logic from the base ExtensionInstance class to the function specification
  • Adds watch configuration for admin extensions that only watches the static_root directory when configured
  • Sets default behavior where 'configuration' experience extensions watch nothing and 'extension' experience extensions watch everything
  • Moves default ignore patterns from the file watcher service to the extension instance level

How to test your changes?

  1. Create a function extension with custom build.watch configuration and verify it only watches the specified paths plus default files (locales, GraphQL, TOML)
  2. Create an admin extension with static_root configured and verify it only watches files in that directory
  3. Create other extension types and verify they follow the default watching behavior based on their experience type
  4. Run dev sessions and confirm file changes trigger rebuilds appropriately for each extension type

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing, so I've added a changelog entry with pnpm changeset add

Copy link
Copy Markdown
Contributor Author

isaacroldan commented Apr 8, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch 3 times, most recently from 0748fb6 to 756d842 Compare April 8, 2026 15:56
@isaacroldan isaacroldan changed the base branch from main to graphite-base/7220 April 8, 2026 16:19
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch from 756d842 to d70b812 Compare April 8, 2026 16:19
@isaacroldan isaacroldan changed the base branch from graphite-base/7220 to 04-08-use_extension_handle_to_identify_extensions_in_file-watcher April 8, 2026 16:19
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch from d70b812 to dbe5497 Compare April 8, 2026 16:49
@isaacroldan isaacroldan changed the base branch from 04-08-use_extension_handle_to_identify_extensions_in_file-watcher to graphite-base/7220 April 8, 2026 16:53
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch from dbe5497 to d33c06d Compare April 8, 2026 17:12
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch from d33c06d to 1e0e9ea Compare April 9, 2026 10:25
@isaacroldan isaacroldan changed the base branch from graphite-base/7220 to 04-08-use_extension_handle_to_identify_extensions_in_file-watcher April 9, 2026 10:25
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch from 1e0e9ea to 7efd3f7 Compare April 9, 2026 13:12
@isaacroldan isaacroldan marked this pull request as ready for review April 9, 2026 13:20
@isaacroldan isaacroldan requested a review from a team as a code owner April 9, 2026 13:20
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch 3 times, most recently from 4c6daca to 1ba2dd9 Compare April 9, 2026 13:29
@isaacroldan isaacroldan force-pushed the 04-08-use_extension_handle_to_identify_extensions_in_file-watcher branch from 6a83b0d to 7403589 Compare April 9, 2026 13:35
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch from 1ba2dd9 to 5dfacdb Compare April 9, 2026 13:35
Copy link
Copy Markdown
Contributor

@craigmichaelmartin craigmichaelmartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love these changes! Just a few comments I want to make sure we evaluate!

@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch 2 times, most recently from 8c27933 to fc760cc Compare April 9, 2026 14:19
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch 2 times, most recently from 3383e69 to d1271b9 Compare April 9, 2026 14:32
@isaacroldan isaacroldan force-pushed the 04-08-use_extension_handle_to_identify_extensions_in_file-watcher branch from 7403589 to 296ba04 Compare April 9, 2026 14:32
Copy link
Copy Markdown
Contributor

@craigmichaelmartin craigmichaelmartin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/ui.d.ts
 import { Logger, LogLevel } from '../../public/node/output.js';
-import React from 'react';
 import { Key, RenderOptions } from 'ink';
 import { EventEmitter } from 'events';
-/**
- * Signal that the current Ink tree is done. Must be called within an
- * InkLifecycleRoot — throws if the provider is missing so lifecycle
- * bugs surface immediately instead of silently hanging.
- */
-export declare function useComplete(): (error?: Error) => void;
-/**
- * Root wrapper for Ink trees. Owns the single `exit()` call site — children
- * signal completion via `useComplete()`, which sets state here. The `useEffect`
- * fires post-render, guaranteeing all batched state updates have been flushed
- * before the tree is torn down.
- */
-export declare function InkLifecycleRoot({ children }: {
-    children: React.ReactNode;
-}): React.JSX.Element;
 interface RenderOnceOptions {
     logLevel?: LogLevel;
     logger?: Logger;
     renderOptions?: RenderOptions;
 }
 export declare function renderOnce(element: JSX.Element, { logLevel, renderOptions }: RenderOnceOptions): string | undefined;
-export declare function render(element: JSX.Element, options?: RenderOptions): Promise<void>;
+export declare function render(element: JSX.Element, options?: RenderOptions): Promise<unknown>;
 export declare class Stdout extends EventEmitter {
     columns: number;
     rows: number;
     readonly frames: string[];
     private _lastFrame?;
     constructor(options: {
         columns?: number;
         rows?: number;
     });
     write: (frame: string) => void;
     lastFrame: () => string | undefined;
 }
 export declare function handleCtrlC(input: string, key: Key, exit?: () => void): void;
 export {};
packages/cli-kit/dist/public/node/ui.d.ts
@@ -34,7 +34,7 @@ export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps
  * 00:00:00 │ frontend │ third frontend message
  *
  */
-export declare function renderConcurrent({ renderOptions, ...props }: RenderConcurrentOptions): Promise<void>;
+export declare function renderConcurrent({ renderOptions, ...props }: RenderConcurrentOptions): Promise<unknown>;
 export type AlertCustomSection = CustomSection;
 export type RenderAlertOptions = Omit<AlertOptions, 'type'>;
 /**

isaacroldan and others added 3 commits April 10, 2026 17:39
Co-authored-by: Claude Code <claude-code@anthropic.com>
…onWatchConfig

Co-authored-by: Claude Code <claude-code@anthropic.com>
Co-authored-by: Claude Code <claude-code@anthropic.com>
@isaacroldan isaacroldan force-pushed the 04-08-use_extension_handle_to_identify_extensions_in_file-watcher branch from 296ba04 to b1996f6 Compare April 10, 2026 15:40
@isaacroldan isaacroldan force-pushed the 04-08-extract_custom_watch_paths_to_specifications branch from d1271b9 to 06b34f4 Compare April 10, 2026 15:40
Base automatically changed from 04-08-use_extension_handle_to_identify_extensions_in_file-watcher to main April 10, 2026 16:21
@isaacroldan isaacroldan added this pull request to the merge queue Apr 10, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 10, 2026
@isaacroldan isaacroldan added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit fc4ffee Apr 10, 2026
30 of 66 checks passed
@isaacroldan isaacroldan deleted the 04-08-extract_custom_watch_paths_to_specifications branch April 10, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants